/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ifs.RnD.Graph;

import ifs.RnD.svnRead.DisplayRepositoryTree;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

/**
 *
 * @author chjslk
 */
class NodeMenuListener extends MouseAdapter {

    String URL;
    String type;
    DisplayRepositoryTree disRepoTree;

    /** 
     * @param revisionUrl
     *  @param nType
     *  @param dRepoTree
     */
    NodeMenuListener(String revisionUrl, String nType, DisplayRepositoryTree dRepoTree) {

        URL = revisionUrl;
        type = nType;
        disRepoTree = dRepoTree;
    }
    //When mouse pressed

    @Override
    public void mousePressed(MouseEvent e) {
        if (e.isPopupTrigger()) {
            doPop(e);
        }
    }
    //When mouse released

    @Override
    public void mouseReleased(MouseEvent e) {
        if (e.isPopupTrigger()) {
            doPop(e);
        }
    }
    //Set the popup menu on the node

    private void doPop(MouseEvent e) {
        NodeMenu menu = new NodeMenu(URL, type, disRepoTree);
        menu.show(e.getComponent(), e.getX(), e.getY());
    }
}
